
#include "Network/TcpServer.h"
#include "taskManager.h"
#include "Network/Buffer.h"
enum dev_online {
    OFFLINE_STATUS = 0,
    ONLINE_STATUS=1,
};

class deviceServicetcp :  public Session
{
public:
    deviceServicetcp(const Socket::Ptr& sock) :
        Session(sock) {
       // DebugL;
    }

    ~deviceServicetcp() {
        //DebugL;
    }

    //static deviceServicetcp& Instance();

    virtual void onRecv(const Buffer::Ptr& buf) override;
    virtual void onError(const SockException& err) override;
    virtual void onManager() override;

    void inputData(const Buffer::Ptr& buf, function<void(const char*, size_t, size_t)> cb);
    void parseSia(const char* data, int len);
    void parseHeartBeat(const char* data, int len);

    toolkit::BufferLikeString _remain_data;
    size_t _remain_data_size = 0;
    std::shared_ptr<toolkit::Timer> _heartbeat_timer;
    int _online_status = 0;
    int _heart_cnt = 0;
    string _account = "";
};